import statsmodels.api as sm
import numpy as np

factor_1 = [6, 1, 2, 7]
return_profit = [0.02, 0.004, 0.005, 0.007]

x_ = sm.add
y = return_profit

model = sm.OLS(y, x_)
results = model.fit()

pre_return_profit = results.params[0] + np.asarray(factor_1) * results.params[1]

corr = np.corrcoef(pre_return_profit, return_profit)
print(corr)
